package WizardInstall;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

/**
 * Register page
 * @author Guy & Liel
 *
 */
class RegisterPage extends WizardPage 
{
	public static final String PAGE_NAME = "Register";
	public static final int PORT = 8880;
	private Text textUserName;
	private Text textPassword;
	private Text textRepassword;
	private Text textEmail;
	private Text textError;

	/**
	 * Constructor to register page
	 */
	public RegisterPage() {
		super(PAGE_NAME, "Register Page", null);
	}
	/**
	 * Create the controls(buttons,Labels,text)
	 */
	public void createControl(Composite parent) 
	{
		Composite topLevel = new Composite(parent, SWT.NONE);
		topLevel.setLayout(new GridLayout(2,false));

		//User Name
		Label l1=new Label(topLevel, SWT.CENTER);
		l1.setText("UserName: ");
		textUserName = new Text(topLevel, SWT.SINGLE);
		textUserName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		//Password
		Label l2=new Label(topLevel, SWT.CENTER);
		l2.setText("Password: ");
		textPassword = new Text(topLevel, SWT.SINGLE | SWT.PASSWORD);
		textPassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		//Re-password
		Label l3=new Label(topLevel, SWT.CENTER);
		l3.setText("Re-Password: ");
		textRepassword = new Text(topLevel, SWT.SINGLE | SWT.PASSWORD);
		textRepassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		//Email
		Label l4=new Label(topLevel, SWT.CENTER);
		l4.setText("Email: ");
		textEmail = new Text(topLevel, SWT.SINGLE);
		textEmail.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		textError=new Text(topLevel, SWT.MULTI | SWT.WRAP);
		//textError.setForeground(S)
		textError.setLayoutData(new GridData(GridData.FILL_BOTH));
		textError.setEnabled(false);
		
		
		
		setControl(topLevel);
		setPageComplete(true);
	}
	/**
	 * set text error
	 * @param strError
	 */
	public void updateTextError(String strError)
	{
		this.textError.setText(strError);
	}
	/**
	 * get user name
	 * @return String
	 */
	public String getUserName() {
		return textUserName.getText();
	}
	/**
	 * Get password
	 * @return String-password
	 */
	public String getPassword() {
		return textPassword.getText();
	}
	/**
	 * Get re-password 
	 * @return String
	 */
	public String getTextRepassword() {
		return textRepassword.getText();
	}
	/**
	 * Get an email
	 * @return String
	 */
	public String getTextEmail() {
		return textEmail.getText();
	}


}


